<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>kq.1.06-socket</title>
<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
<script src="../kq.1.06.dev.js"></script>
</head>

<body>

</body>
<script>
$Q.config('DEBUG',true);
</script>
<script>
var socket = $Q.socket({
	url:'ws://sunac.kuoqi.com:6520',//socket的请求地址
	dataType:'json',//请求的数据类型
	//额外的数据信息
	data:{
		token:'123456',
	},
	success:function(rs){ },
	onOpen:function(){console.log('socket onOpen success')},
	onError:function(){console.log('socket onError success')},
	onClose:function(){console.log('socket onClose success')},
});
//初始化成功之后会执行本方法
socket.ready(function(){
	//这个是发送信息的方法
	socket.send({
		kuoqi:'1223455',	
	});
});
//自定义数据接收器，自定义之后success将失效
socket.message(function(rs){
	console.log(rs);
});
</script>
</html>
